package file;

import java.io.File;
import java.io.FileFilter;

public class Test3 {
    /**
     *  获取 file 包中大小超过 1000 字节的所有子项
     */
    public static void main(String[] args) {
        File dir = new File("./BJava_SE_API/src/file");
        if (dir.isDirectory()){
            File[] files = dir.listFiles(new FileFilter() {
                @Override
                public boolean accept(File pathname) {
                    return pathname.length()>1000;
                }
            });
            for (File f : files) {
                System.out.println(f.getName()+":"+f.length()+"字节");
            }
        }
    }
}
